#ifndef QTSIGNALCATCHER_H
#define QTSIGNALCATCHER_H

#include <qtdbusextrasglobal.h>

#include <QObject>

class QtSignalCatcherBasePrivate;
class QTDBUSEXTRAS_EXPORT QtSignalCatcherBase : public QObject
{
    Q_OBJECT
    Q_DECLARE_PRIVATE(QtSignalCatcherBase)
public Q_SLOTS:
    void catchObject(const QObject *object, QList<const QMetaObject *> metaObjects = {});
    void releaseObject(const QObject *object, QList<const QMetaObject *> metaObjects = {});

Q_SIGNALS:
    void catched(QObject *object, const QMetaMethod &signal, void **argv);

protected:
    explicit QtSignalCatcherBase(QObject *parent = nullptr);
    void relay(void **argv);
};

class QTDBUSEXTRAS_EXPORT QtSignalCatcher final : public QtSignalCatcherBase
{
public:
    explicit QtSignalCatcher(QObject *parent = nullptr);

    int qt_metacall(QMetaObject::Call call, int methodId, void **argv) override;
};

#endif // QTSIGNALCATCHER_H
